/*
 * @Description: 访问日志模型
 * @Author: zheng yiliang
 * @Date: 2021-04-13 20:58:34
 * @LastEditTime: 2021-06-06 17:40:07
 * @LastEditors: zheng yiliang
 */


const mongoose = require('../core/mongodb')
const { Schema, model } = mongoose
const autoIncrement = require('mongoose-auto-increment-fix');
// 访问日志模型
const visitlogSchema = new Schema({
  IP: { type: String, required: true },
  IP_Source: { type: String },
  plate: { type: String },
  browser: { type: String },
  actions: { type: String },
  create_time: { type: Date, default: Date.now }
});
// 自增ID插件配置
visitlogSchema.plugin(autoIncrement.plugin, {
  model: 'Visitlog',
  field: 'id',
  startAt: 1,
  incrementBy: 1
});
// 标签模型
module.exports = model('Visitlog', visitlogSchema);
